package com.yuan.pdf.controller;

import com.yuan.pdf.util.JavaToPdfHtmlFreeMarker;

import java.util.HashMap;
import java.util.Map;

/**
 * 生成合同
 * @author siyuan
 * @date 2023/1/9 13:54
 * @Descript 1.生成pdf合同2.添加签章
 */
public class CreatContract {
    //模板名称
    static String HTML = "contract.html";
    //生成的pdf存放路径
    static String DEST = "D:\\app\\user_contract\\";
    //生成的pdf名称
    static String fileName = "合同D20230109XiongDa-temp.pdf";

    public static void main(String[] args) throws Exception {
        Map<String,Object> data = new HashMap();
        data.put("合同编号","D20230109SDNQB");
        data.put("甲方姓名","熊大");
        data.put("签字日期","2023.01.09");
        String content = JavaToPdfHtmlFreeMarker.freeMarkerRender(data,HTML);
        JavaToPdfHtmlFreeMarker.createPdf(content,DEST+"/"+fileName);
    }
}
